<?php 
defined('_JEXEC') or die('Restricted access'); 

//require_once( dirname(__FILE__).DS.'helper.php' );

require(JModuleHelper::getLayoutPath('mod_search_sketchup'));

$title = $params->get('moduletitle', '');
$document =& JFactory::getDocument();
$css =JURI::base() .'modules/mod_search_sketchup/assets/css/mod_search_sketchup.css';
$document ->addStyleSheet ($css);

$pageoption = JRequest::getVar( 'option', '' );

$backlink = JRoute::_('index.php?option=' . $option . '&view=all' );
function renderRecentSketchups(&$sketchup, &$params)
	{
		global $options, $mainframe;
		$uri =& JFactory::getURI();
		$link = JRoute::_('index.php?option=' . $option . '&view=all' );
		return $link;
	}
function renderSearchSketchups(&$sketchup, &$params)
	{
		global $options, $mainframe;
		$uri =& JFactory::getURI();
		$link = JRoute::_('index.php?option=' . $option . '&view=search' );
		return $link;
	}



function getCountry() {
			
			//$name, $value, &$node, $control_name
			global $options, $mainframe;
			$db =&JFactory::getDBO();
			$query = "SELECT Distinct country as value FROM #__sketchup WHERE published = '1' ORDER BY country ASC";
			$db->setQuery($query);
			$options = $db->loadObjectList();
			
			if ( $db->getErrorNum() ) {
			JError::raiseWarning( 200, $db->getErrorMsg() );
			}
			
			// make the select do something
			$js = 'onchange="document.getElementById(\'adminForm\').submit();"';
			//$js = 'onchange="this.form.submit();"';
				
			array_unshift($options, JHTML::_('select.option', '-- select --', $options ));
			return JHTML::_('select.genericlist', $options,  "filter_country", 'class="input" size="1" ' .$js, 'value', 'value', 0);	
			
			//return JHTML::_('select.genericlist',  $options, $control_name. '[' . $f_name . ']', 'class="inputbox"', 'id', 'name', $value, $control_name . $f_name );
			}

?> 

 
